<?php

class Positions extends Model{

	function Positions()
    {
        parent::Model();
    	$this->_table = 'positions';
    }
    
    function get_all()
	{
		$this->db->order_by('id', 'asc');
		return $this->db->get($this->_table);
	}
	
	function get_all_of_event($event_id)
	{
		$this->db->where('event_id', $event_id);
		$this->db->order_by("order", "asc"); 
		return $this->db->get($this->_table);
	}
	
	function get_pos_by_id($pos_id)
	{
		$this->db->where('id', $pos_id);
		
		return $this->db->get($this->_table);
		
	}
	function saveForm($form_data)
	{
		$this->db->insert($this->_table, $form_data);
		
		if ($this->db->affected_rows() == '1')
		{
			return TRUE;
		}
		
		return FALSE;
	}
		
}

?>